package com.shop.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.pojo.pms.Pms_Category_Brand_Relation;
import com.shop.service.Pms_Category_Brand_Relation_Service;
import com.shop.utils.LayuiUtils;
import com.shop.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 品牌分类维护表
 */
@RestController
@RequestMapping("/category_brand")
public class Pms_Category_Brand_Relation_Controller {

    @Autowired
    private Pms_Category_Brand_Relation_Service pms_category_brand_relation_service;


    /***
     * 查询所有的分类品牌信息进行显示
     * @param page
     * @param limit
     * @param pcbr
     * @return
     */
    @GetMapping("/find_admin_category_brand_All")
    public LayuiUtils<Pms_Category_Brand_Relation>   find_admin_category_brand_All(Integer page,Integer limit,Pms_Category_Brand_Relation pcbr){

        Page<Pms_Category_Brand_Relation> Pages = new Page<>(page,limit);

        return pms_category_brand_relation_service.find_admin_category_brand_All(Pages,pcbr);
    }

    /***
     *增加分类品牌信息进行 维护
     * @param pcb
     * @return
     */
    @PostMapping("/insert_admin_category_brand_All")
    public R insert_admin_category_brand_All(Pms_Category_Brand_Relation pcb){
        System.out.println(pcb);
        return pms_category_brand_relation_service.insert_admin_category_brand_All(pcb);
    }

    /***
     * 删除分类品牌信息
     * @param id
     * @return
     */
    @DeleteMapping("/delete_admin_category_brand_All")
    public R delete_admin_category_brand_All(@RequestParam List<Integer> id){
        return pms_category_brand_relation_service.delete_admin_category_brand_All(id);
    }

    /***
     * 修改分类品牌信息进行维护
     * @param pmb
     * @return
     */
    @PutMapping("/up_admin_category_brand_All")
    public R up_admin_category_brand_All(Pms_Category_Brand_Relation pmb){
        return  pms_category_brand_relation_service.up_admin_category_brand_All(pmb);
    }
}
